#ifndef CHARACTER_HH
#define CHARACTER_HH

#include "ICharacter.hh"
#include "Item.hh"

class Character : public ICharacter {
    
private:
    std::string name;
    std::string description;
    unsigned _health;
    unsigned maxHealth;
    unsigned _attack;
    unsigned _defense;
    std::vector<Item*> inventory;

public:
    Character(const std::string& name, const std::string& description, unsigned health, unsigned attack, unsigned defense);
    ~Character();
    Character(const Character& other); // Copy constructor
    Character& operator=(const Character& other); // Copy assignment operator

    bool isAlive() const override;
    void setDescription(const std::string &description) override;
    bool takeDamage(unsigned damage) override;
    bool attack(ICharacter& target) override;
    bool heal(unsigned amount) override;

    std::string getName() const override;
    std::string getDescription() const override;
    unsigned getHealth() const override;
    unsigned getMaxHealth() const override;
    unsigned getAttack() const override;
    unsigned getDefense() const override;
    std::string toString() const override;

    void setHealth(unsigned health) override;
    void addHealth(unsigned health) override;
    void setMaxHealth(unsigned maxHealth) override;
    void setAttack(unsigned attack) override;
    void addAttack(unsigned attack) override;
    void setDefense(unsigned defense) override;
    void addDefense(unsigned defense) override;
    void setName(const std::string& name) override;
    void setInventory(const std::vector<Item*>& inventory) override;


    void addToInventory(Item* item) override;
    void displayInventory() const override;

    void display() const override;
    
    void modifyDefense(int value) {
        _defense += value;
    }
    // operator overloading
    Character& operator+=(unsigned health);  // addHealth
    Character& operator+=(const std::pair<std::string, unsigned>& pair); // addAttack / addDefense
    Character& operator-=(int defense); // modifyDefense

    friend std::ostream& operator<<(std::ostream& os, const Character& player);

};

#endif 